package com.dy.dao;

import com.dy.bean.Sugar;
import com.dy.bean.SugarTwo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SuagrDao {
    @Select("call sp2")
    List<Sugar> showYd();
    @Select("SELECT b.name 'name',count(*)'value' FROM order_info o \n" +
            "LEFT JOIN order_cargo c on c.order_id = o.id\n" +
            "LEFT JOIN base_dic b on c.cargo_type = b.id\n" +
            "GROUP BY b.name")
    List<Sugar> showXd();
    @Select("SELECT b.org_name 'name',\n" +
            "sum(actual_distance) 'distance',\n" +
            "count(*)'num',\n" +
            "sum(TIMESTAMPDIFF(SECOND,actual_start_time,actual_end_time))'time',\n" +
            "sum(TIMESTAMPDIFF(SECOND,actual_start_time,actual_end_time))/count(*) 'avgTime',\n" +
            "sum(actual_distance)/count(*)'avgNum'\n" +
            "FROM transport_task t \n" +
            "LEFT JOIN line_base_info l on t.line_id = l.id\n" +
            "LEFT JOIN base_organ b on l.org_id = b.id\n" +
            "GROUP BY b.org_name\n")
    List<SugarTwo> showJg();
}
